package com.kksoft.readcm.activity;

import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.kksoft.readcm.a.Appconfig;
import com.kksoft.readcm.a.ItemAppObservable;
import com.kksoft.readcm.a.LoginAppObservable;
import com.kksoft.readcm.c.c;
import com.kksoft.readcm.objects.l;
import com.kksoft.readcm.objects.n;
import com.kksoft.readcm.objects.ReadListAdapter;
import com.kksoft.readcm.pro.R;
import com.kksoft.readcm.views.p;

public class ReadListActivity extends ListViewActivity
  implements c
{
  private View A = null;
  private ProgressBar B = null;
  private TextView C = null;
  private TextView D = null;
  private Button E = null;
  private ap F;
  private AsyncTask G;
  private int H = 1;
  private int I = 0;
  private String J = null;
  private LinearLayout z = null;

  
  static void a(ReadListActivity readlistactivity)
  {
      readlistactivity.F = null;
  }

  static void a(ReadListActivity readlistactivity, int i1)
  {
      readlistactivity.f(i1);
  }

  static void a(ReadListActivity readlistactivity, int i1, String s1)
  {
      readlistactivity.a(i1, s1);
  }

  static void b(ReadListActivity readlistactivity)
  {
      readlistactivity.Q();
  }

  static void b(ReadListActivity readlistactivity, int i1)
  {
      readlistactivity.H = i1;
  }

  static void c(ReadListActivity readlistactivity)
  {
      readlistactivity.a(0, true);
  }
  
  private void P()
  {
    String str = A();
    int i = H();
    f(i);
  }

  private void Q()
  {
    Appconfig.getThis().getItemAppObservable().a(this);
  }

  private void a(int paramInt, String paramString)
  {
    this.I = paramInt;
    if (this.I == 3);
    for (this.J = paramString; ; this.J = null)
    {
      u();
      return;
    }
  }

  private void a(int paramInt, boolean paramBoolean)
  {
    this.A.setVisibility(paramInt);
//    if (paramInt != 8)
//    {
//      if (!paramBoolean)
//        break label52;
//      this.B.setVisibility(8);
//      this.D.setVisibility(0);
//      this.C.setVisibility(0);
//      this.E.setVisibility(0);
//    }
//    while (true)
//    {
//      return;
//      label52: this.B.setVisibility(0);
//      this.D.setVisibility(8);
//      this.C.setVisibility(8);
//      this.E.setVisibility(8);
//    }
  }

  private void f(int paramInt)
  {
	  ItemAppObservable locale = Appconfig.getThis().getItemAppObservable();
    String str = A();
    locale.a(str, paramInt, this);
  }

  protected final void B()
  {
    if (this.F != null)
    {
      Handler localHandler1 = this.m;
      ap localap1 = this.F;
      localHandler1.removeCallbacks(localap1);
    }
    String str = A();
    int i = H();
    ap localap2 = new ap(this, str, i);
    this.F = localap2;
    Handler localHandler2 = this.m;
    ap localap3 = this.F;
    boolean bool = localHandler2.postDelayed(localap3, 850L);
  }

  protected final int C()
  {
    return 2130837536;
  }

  protected final String D()
  {
    return getString(2131165238);
  }

  public final void G()
  {
    Q();
  }

  public final void L()
  {
    if (this.H == 3);
    for (int i = 3; ; i = 2)
    {
      this.H = i;
//      a(8, 0);
      u();
      return;
    }
  }

  public final void M()
  {
    if (this.H == 7);
    for (int i = 7; ; i = 6)
    {
      this.H = i;
//      a(0, 0);
      return;
    }
  }

  public final boolean N()
  {
	return false;
//    if (this.G != null);
//    for (int i = 1; ; i = 0)
//      return i;
  }

  public final void a(AsyncTask paramAsyncTask)
  {
//    if (this.G != null)
//      boolean bool = this.G.cancel(0);
//    this.G = paramAsyncTask;
  }

  public final void a(AsyncTask asynctask, final boolean flag, final int i1, final String s1)
  {
      if(asynctask == null || G == asynctask)
      {
    	  boolean flag1;
          if(H != 7 && H != 3)
              flag1 = false;
          else
              flag1 = true;
          G = null;
          if(flag1)
          {
              Handler handler = m;
              handler.postDelayed(new Runnable(){

				@Override
				public void run() {
					// TODO Auto-generated method stub
				        byte byte0;
				        if(flag)
				            byte0 = 8;
				        else
				            byte0 = 5;
				        ReadListActivity.b(ReadListActivity.this, byte0);
				        ReadListActivity.a(ReadListActivity.this, i1, s1);
				        if(flag)
				            ReadListActivity.c(ReadListActivity.this);
				}}, 400L);
          } else
          {
              int j1;
              if(flag)
                  j1 = 8;
              else
                  j1 = 5;
              H = j1;
              a(i1, s1);
              if(flag)
                  a(0, true);
          }
      }

  }

  protected final void a(ContextMenu paramContextMenu, AdapterView.AdapterContextMenuInfo paramAdapterContextMenuInfo)
  {
//    String str1 = getString(2131165237);
//    MenuItem localMenuItem1 = paramContextMenu.add(0, 18, 0, str1);
//    String str2 = getString(2131165233);
//    MenuItem localMenuItem2 = paramContextMenu.add(0, 16, 0, str2);
  }

  protected final void a(boolean paramBoolean1, boolean paramBoolean2)
  {
    this.btnSync.setVisibility(View.GONE);
    this.progressbar.setVisibility(View.GONE);
  }

  protected final boolean a(MenuItem paramMenuItem, AdapterView.AdapterContextMenuInfo paramAdapterContextMenuInfo)
  {
    int i;
    switch (paramMenuItem.getItemId())
    {
    case 17:
    default:
      i = 0;
    case 18:
    case 19:
    case 16:
    }
//    while (true)
//    {
//      return i;
//      e locale = Appconfig.q().c();
//      int j = paramAdapterContextMenuInfo.position;
//      l locall1 = d(j);
//      int k = locale.a(locall1, 0, 1, 1);
//      o localo = this.l;
//      int m = paramAdapterContextMenuInfo.position;
//      l locall2 = d(m);
//      localo.a(locall2);
//      i = 1;
//      continue;
//      i = 1;
//      continue;
//      if (this.n == null)
//      {
//        int n = paramAdapterContextMenuInfo.position;
//        l locall3 = d(n);
//        String str1 = locall3.e();
//        String str2 = locall3.k();
//        PackageManager localPackageManager = getPackageManager();
//        p localp = new p(str1, str2, this, localPackageManager);
//        this.n = localp;
//      }
//      i = 1;
//    }
	return false;
  }

  protected final n a_()
  {
	return null;
//    if (!Appconfig.q().m())
//      this.H = 10;
//    while (true)
//    {
//      return this.k;
////      n localn = Appconfig.q().c().h();
//      this.k = localn;
//      if ((Appconfig.q().c().k()) || (this.k == null))
//      {
//        this.k = null;
//        P();
//        continue;
//      }
//      u();
//    }
  }

  protected final void b(int paramInt)
  {
    this.o = paramInt;
    boolean bool = App.getSharedPreferences().edit().putInt("sortRead", paramInt).commit();
    String str = A();
    int i = H();
    f(i);
  }

  public final void b(AsyncTask paramAsyncTask)
  {
    if (this.G != paramAsyncTask);
//    while (true)
//    {
//      return;
////      this.H = 4;
//      this.G = null;
//      this.I = 0;
//      this.J = null;
//      a(0);
//      if (Appconfig.q().c().l() == 1)
//        F();
//      u();
//    }
  }

  protected final void b(Menu menu)
  {
	  super.b(menu);
      menu.add(-1, 24, 0, R.string.nm_reading_list).setIcon(R.drawable.ic_menu_reading_list);
      menu.add(-1, 25, 0, R.string.nm_current_list).setIcon(R.drawable.ic_menu_current_list);
  }

  protected final void c()
  {
    this.z = (LinearLayout)View.inflate(this, R.layout.list_header_container, null);
    this.A = View.inflate(this, R.layout.list_footer_loading_more, null);
    this.B = (ProgressBar)this.A.findViewById(R.id.list_footer_loading_progress);
    this.C = (TextView)this.A.findViewById(R.id.list_footer_loading_t);
    this.D = (TextView)this.A.findViewById(R.id.list_footer_loading_m);
    this.E = (Button)this.A.findViewById(R.id.list_footer_loading_retry);
    this.E.setOnClickListener(new OnClickListener(){

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			ReadListActivity.b(ReadListActivity.this, 7);
		    ReadListActivity.b(ReadListActivity.this);
		}
    	
    });
    this.z.addView(this.A);
    this.listview.addFooterView(this.z, null, false);
  }

  protected final String e()
  {
    return "sortRead";
  }

  protected final String f()
  {
    return getString(2131165189);
  }

  protected final boolean h()
  {
    return false;
  }

  protected final boolean i()
  {
	return false;
//    if (this.G != null);
//    for (int i = 1; ; i = 0)
//      return i;
  }

  protected final int j()
  {
    return 3;
  }

  protected final boolean k()
  {
	return false;
//    if (this.I != 0);
//    for (int i = 0; ; i = 1)
//      return i;
  }

  protected final String l()
  {
    switch (this.I)
    {
    default:
    case 1:
    case 2:
    case 3:
    }
    for (String str = getString(2131165388); ; str = "There was a problem accessing your Read Archive.")
      return str;
  }

  protected final String m()
  {
    String str;
    switch (this.I)
    {
    default:
      str = getString(2131165389);
    case 1:
    case 2:
    case 3:
    }
//    while (true)
//    {
//      return str;
//      str = "Please make sure you are connected to the internet.";
//      continue;
//      if (this.J != null)
//      {
//        str = this.J;
//        continue;
//      }
//      str = "Please make sure you are connected to the internet.";
//    }
	return null;
  }

  protected final String n()
  {
    switch (this.I)
    {
    default:
    case 1:
    case 2:
    case 3:
    }
    for (String str = null; ; str = "Try Again")
      return str;
  }

  protected final void o()
  {
    switch (this.I)
    {
    default:
    case 1:
    case 2:
    case 3:
    }
//    while (true)
//    {
//      return;
//      this.H = 3;
//      P();
//    }
  }

  public void onCreate(Bundle paramBundle)
  {
    this.a = true;
    super.onCreate(paramBundle);
    RelativeLayout.LayoutParams localLayoutParams = (RelativeLayout.LayoutParams)this.edtFilter.getLayoutParams();
    int i = Math.round(a(10.0F));
    int j = localLayoutParams.topMargin;
    int k = localLayoutParams.rightMargin;
    int m = localLayoutParams.bottomMargin;
    localLayoutParams.setMargins(i, j, k, m);
    this.edtFilter.setLayoutParams(localLayoutParams);
  }

  public void onPause()
  {
    Appconfig.getThis().b().d();
    super.onPause();
  }

  protected final void p()
  {
    int i = this.readlistadapter.e();
    if (i == 1)
    {
      Button localButton1 = this.j;
      String str1 = getString(2131165214);
      Object[] arrayOfObject1 = new Object[1];
      String str2 = String.valueOf(i);
      arrayOfObject1[0] = str2;
      String str3 = String.format(str1, arrayOfObject1);
      localButton1.setText(str3);
    }
//    while (true)
//    {
//      return;
//      Button localButton2 = this.j;
//      String str4 = getString(2131165213);
//      Object[] arrayOfObject2 = new Object[1];
//      String str5 = String.valueOf(i);
//      arrayOfObject2[0] = str5;
//      String str6 = String.format(str4, arrayOfObject2);
//      localButton2.setText(str6);
//    }
  }

  protected final int loadType()
  {
    return 1;
  }

  public final void u()
  {
    switch (this.H)
    {
    default:
      this.c.setText(2131165189);
      switch (this.H)
      {
      default:
      case 2:
      case 3:
      case 10:
      case 5:
      case 6:
      case 7:
      case 8:
      case 1:
      case 4:
      case 9:
      }
    case 2:
    case 3:
    case 10:
    }
//    while (true)
//    {
//      return;
//      this.c.setText(2131165200);
//      break;
//      a(1);
//      a(8, 0);
//      continue;
//      a(3);
//      a(8, 0);
//      continue;
//      a(2);
//      continue;
//      a(8, 0);
//      if ((this.l == null) || (this.k == null))
//      {
//        a(1);
//        continue;
//      }
//      if (this.l.getCount() <= 0)
//      {
//        if ((this.l.c()) || (this.l.a() > 0))
//        {
//          a(2);
//          continue;
//        }
//        if (A().length() > 0)
//        {
//          a(4);
//          continue;
//        }
//        if (this.H == 1)
//        {
//          a(1);
//          continue;
//        }
//        a(3);
//        continue;
//      }
//      a(2);
//    }
  }

  protected final void v()
  {
  }

  protected final String x()
  {
    return "filterRead";
  }
}

/* Location:           E:\AndroidDecompiler\jd-gui-0.3.3.windows\newrclasses.dex.dex2jar.jar
 * Qualified Name:     com.kksoft.readcm.activity.ReadListActivity
 * JD-Core Version:    0.6.0
 */